﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using Domain;
using Business;



namespace HotelBrisayArena
{
    public partial class Home : System.Web.UI.Page
    {
            SeccionBusiness seccionBusiness = new SeccionBusiness(WebConfigurationManager.ConnectionStrings["ApplicationServices"].ToString());
            ImagenBusiness imagenBusiness = new ImagenBusiness(WebConfigurationManager.ConnectionStrings["ApplicationServices"].ToString());
            Seccion seccion = new Seccion(); 
            Imagen  imagen = new Imagen();
        protected void Page_Load(object sender, EventArgs e)
        {
         
            seccion = seccionBusiness.GetSeccion(1);
            imagen = imagenBusiness.GetImagen(seccion.IdImagen);
            //imagen = imagenBusiness.GetImagen(13);
            byte[] imageBytes = imagen.Image;
            string base64ImageString = ConvertBytesToBase64(imageBytes);
            Image1.Src = "data:image/jpg;base64," + base64ImageString;
            

            Label1.Text = seccion.Descripcion;
        }

        public string ConvertBytesToBase64(byte[] imageBytes)
        {
            return Convert.ToBase64String(imageBytes);
        }
    }
}